﻿



using System;
using System.Collections.Generic;
using System.ServiceModel;
using Demo.DataObjects;
using Demo.Infrastructure;

namespace Demo.ServiceContracts
{
    [ServiceContract(Namespace="http://www.demo.com")]
    public interface IActionService
    {
        /// <summary>
        /// 创建行为
        /// </summary>
        /// <param name="name">行为名称</param>
        /// <param name="moduleId">模块ID</param>
        /// <param name="sort">排序值</param>
        [OperationContract()]
        [FaultContract(typeof(FaultData))]
        [Cache(CacheType.Remove, "GetActionDTO", "GetActionDTOWithUserId")]
        void CreateAction(string name,Int32 moduleId,Int32 sort = 0);

        /// <summary>
        /// 获取行为DTO
        /// </summary>
        /// <param name="name">行为名称</param>
        /// <returns></returns>
        [OperationContract()]
        [FaultContract(typeof(FaultData))]
        [Cache(CacheType.Get)]
        ActionDTO GetActionDTOWithName(string name);

        /// <summary>
        /// 获取行为DTO
        /// </summary>
        /// <param name="id">行为ID</param>
        /// <returns></returns>
        [OperationContract()]
        [FaultContract(typeof(FaultData))]
        [Cache(CacheType.Get)]
        ActionDTO GetModuleDTOWithId(Int32 id);

        /// <summary>
        /// 获取所有行为DTO
        /// </summary>
        /// <param name="userid">用户ID</param>
        /// <returns></returns>
        [OperationContract()]
        [FaultContract(typeof(FaultData))]
        [Cache(CacheType.Get)]
        IList<ActionDTO> GetActionDTOWithUserId(Int32 userid);

        /// <summary>
        /// 获取所有行为DTO
        /// </summary>
        /// <returns></returns>
        [OperationContract()]
        [FaultContract(typeof(FaultData))]
        [Cache(CacheType.Get)]
        IList<ActionDTO> GetActionDTO();

        /// <summary>
        /// 更改行为
        /// </summary>
        /// <param name="oldName">旧行为名称</param>
        /// <param name="newName">新行为名称</param>
        /// <returns></returns>
        [OperationContract()]
        [FaultContract(typeof(FaultData))]
        [Cache(CacheType.Remove, "GetActionDTOWithName", "GetModuleDTOWithId")]
        bool ChangeActionWithName(string oldName, string newName);

        ///// <summary>
        ///// 更改行为
        ///// </summary>
        ///// <param name="Name">行为名称</param>
        ///// <param name="newModuleId">新模块ID</param>
        ///// <returns></returns>
        //[OperationContract()]
        //[FaultContract(typeof(FaultData))]
        //[Cache(CacheType.Remove, "GetActionDTOWithName", "GetModuleDTOWithId")]
        //bool ChangeActionWithName(string Name, Int32 newModuleId);
    }
}
